home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Colour of our Skin
/
The Colour of Our Skin.iso
/
mac
/
tv.swf
/
scripts
/
DefineSprite_27
/
frame_1
/
DoAction.as
Wrap
Text File
|
2006-09-07
|
3KB
|
148 lines
function playMovie()
{
if(!isStarted)
{
ns.play(file);
playText.txt.text = "LOADING ..";
isStarted = true;
}
else
{
ns.pause();
}
pauseBut._visible = true;
playBut._visible = false;
videoDisplay._visible = true;
}
function pauseMovie()
{
ns.pause();
playBut._visible = true;
pauseBut._visible = false;
}
function setDims(w, h)
{
videoDisplay._width = videoBg._width = w;
videoDisplay._height = videoBg._height = h - 20;
playText._x = w / 2 - 120;
playText._y = h / 2 - 20;
playText_bg._x = w / 2 - 240;
playText_bg._y = h / 2 - 22;
playBut._y = pauseBut._y = progressBar._y = volumeBar._y = h - 20;
progressBar._width = w - 56;
volumeBar._x = w - 38;
}
if(!_root.file)
{
file = "video_placeholder.flv";
}
else
{
file = _root.file;
}
autoStart = true;
w = 480;
h = 360;
nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
this.createEmptyMovieClip("snd",0);
snd.attachAudio(ns);
audio = new Sound(snd);
audio.setVolume(80);
videoDisplay.attachVideo(ns);
ns.onMetaData = function(obj)
{
this.totalTime = obj.duration;
};
ns.onStatus = function(object)
{
if(object.code == "NetStream.Play.Stop")
{
ns.seek(0);
ns.pause();
playBut._visible = true;
pauseBut._visible = false;
videoDisplay._visible = false;
playText.txt.text = "CLICK TO PLAY";
}
};
videoBg.onPress = function()
{
if(pauseBut._visible == false)
{
playMovie();
}
else
{
pauseMovie();
}
};
pauseBut.onPress = function()
{
pauseMovie();
};
playBut.onPress = function()
{
playMovie();
};
progressBar.onEnterFrame = function()
{
loaded = this._parent.ns.bytesLoaded;
total = this._parent.ns.bytesTotal;
if(loaded == total && loaded > 1000)
{
this.loa._xscale = 100;
delete this.onEnterFrame;
}
else
{
this.loa._xscale = int(loaded / total * 100);
}
};
progressBar.tme.onEnterFrame = function()
{
this._xscale = ns.time / ns.totalTime * 100;
};
progressBar.loa.onPress = function()
{
this.onEnterFrame = function()
{
scl = this._xmouse / this._width * (this._xscale / 100) * (this._xscale / 100);
if(scl < 0.02)
{
scl = 0;
}
ns.seek(scl * ns.totalTime);
};
};
progressBar.loa.onRelease = progressBar.loa.onReleaseOutside = function()
{
delete this.onEnterFrame;
pauseBut._visible != false ? null : videoDisplay.pause();
};
volumeBar.back.onPress = function()
{
this.onEnterFrame = function()
{
var _loc2_ = this._xmouse;
if(_loc2_ >= 0 && _loc2_ <= 20)
{
this._parent.mask._width = this._xmouse;
this._parent._parent.audio.setVolume(this._xmouse * 5);
}
};
};
volumeBar.back.onRelease = volumeBar.back.onReleaseOutside = function()
{
delete this.onEnterFrame;
};
setDims(w,h);
pauseBut._visible = false;
imageStr = file.substr(0,file.length - 3) + "jpg";
imageClip.loadMovie(imageStr);
if(autoStart == true)
{
playMovie();
}